<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <title>注册</title>
    <script type="text/javascript" src="./static/js/base_v3.2.0.js"></script>
    <link rel="stylesheet" href="./static/new_ui/new_css/base_v3.2.css">
    <script type="text/javascript" src="./static/js/modal.js"></script>
    <link rel="stylesheet" href="./static/new_ui/new_css/modal.css">
    <script type="text/javascript" src="./static/js/jquery-1.8.0.min.js"></script>
    <!-- rsa -->
    <script language="JavaScript" type="text/javascript" src="./static/js/rsa/jsbn.js"></script>
    <script language="JavaScript" type="text/javascript" src="./static/js/rsa/prng4.js"></script>
    <script language="JavaScript" type="text/javascript" src="./static/js/rsa/rng.js"></script>
    <script language="JavaScript" type="text/javascript" src="./static/js/rsa/rsa.js"></script>
    <script language="JavaScript" type="text/javascript" src="./static/js/rsa/base64.js"></script>
    <!-- rsa -->
</head>

<body>

<div class="ex-store-box login-bg">
    <div class="login-content clearFix">
        <a href="javascript:history.go(-1);">
            <img class="login-link" src="./static/new_ui/images/login_2.png" width="30px" alt="">
        </a>
        <img class="reg-tit" src="./static/new_ui/images/reg_tit.png" width="100px" alt="">

        <div style="clear:both"></div>

        <div class="login-explain">
            <div>一秒注册，赠送10币！</div>
        </div>


        <form id="form1" method="post" action="/addphonecustom">
            <input type="hidden" name="from">
            <input type="hidden" value="false" name="isInvite">
            <input type="hidden" value="" name="openid">
            <input type="hidden" value="" name="st">
            <input type="hidden" value="" name="shareMemberId">
            <input type="hidden" value="" name="share">

            <div class="formBox">

                <div class="login-name">
                    <img src="./static/new_ui/images/reg_name.png" width="18px" alt="">
                    <input class="in-phone" type="text" name="name" id="name" value="" maxlength="10" data-name="姓名"
                           placeholder="请输入真实姓名">
                </div>
                 <div class="login-name">
                    <img src="./static/new_ui/images/login_phone.png" width="14px" alt="">
                    <input class="in-phone" type="text" name="mobile" id="mobile" value="" data-name="手机号码" placeholder="注册人手机号">
                    <a class="reg-verify" id="smscodetime" style="display: none;"></a>
                </div>
                <div class="login-name">
                    <img src="./static/new_ui/images/reg_name.png" width="14px" alt="">
                    <input class="in-phone" type="text" name="consultantId" id="consultantId" value="" data-name="置业顾问" placeholder="置业顾问">
                   
                </div>
                <div class="login-name">
                    <img src="./static/new_ui/images/login_phone.png" width="14px" alt="">
                    <input class="in-phone" type="text" name="shareMobile" id="sharemobile" value="" data-name="推荐人手机号码" placeholder="推荐人手机号码">
                    <a class="reg-verify" id="smscodetime" style="display: none;"></a>
                </div>
                <div class="login-name">
                    <img src="./static/new_ui/images/login_pass.png" width="15px" alt="">
                    <input class="in-phone" type="password" maxlength="15" id="password" data-name="新密码" value=""placeholder="请输入密码" name="password">
                    <!-- <input id="passwordEncode" name="password" type="hidden"> -->
                </div>
                <input id="regBtn" type="submit" class="login-button" value="注册">

                <p class="go-login">已有帐号 <a href="./userLogin">去登录</a>
                </p>
            </div>
        </form>
    </div>
</div>

<script id="share_template" type="text/template"></script>
<script type="text/javascript">
    $(function () {
        showDefVal();
    });
    function setupLabel() {

        if ($(".radioSpan input").length) {
            $(".radioSpan").each(function () {
                $(this).removeClass("radioSpan-check");
            });
            $(".radioSpan input[checked=true]").each(function () {
                $(this).parent("span").addClass("radioSpan-check");
            });
        }
        ;
    }
    $(function () {
        var errorMsg = "";
        if (errorMsg != null && errorMsg != "") {
            /* $(".msgPrompt").show();*/
            alertMessage("");
        }


        $(".footerNav a").removeClass("on");
        $(".footerNav a").eq(2).addClass("on");
        if (false) {
            $('#radio1').attr("checked", true);
            $('#radio1').parent().addClass("radioSpan-check");
        } else {
            $('#radio2').attr("checked", true);
            $('#radio2').parent().addClass("radioSpan-check");
        }
        $(".radioSpan").click(function () {
            $(".inputRadio").attr("checked", false);
            $(this).children("input").attr("checked", true);
            setupLabel();
        });
        $('#name').on('touchend', function (e) {
            $(this).focus();
        });
    });

    function validate() {
        var echoText = "";
        var returnValue = true;
        var pwdText = $("#password").val().length;
        //$.each($(".in-phone"),function(i,ele){
        $(".in-phone").each(function () {
            var inputVal = $(this).val();
            if (inputVal == "") {
                echoText = $(this).attr("data-name");
                alertMessage(echoText + "不能为空，请重新输入！");
                returnValue = false;
                return false;
            }
            else {
                echoText = ""
            }
        });
        if (echoText == "") {
            if (!isVaildName($("#name").val())) {
                alertMessage("姓名中不能包含符号！");
                returnValue = false;
                return false;
            }
            if (!isMobel($("#mobile").val())) {
                alertMessage("手机号码格式不对，请重新输入！");
                returnValue = false;
                return false;
            }
            else if (!validCode) {
                alertMessage("该用户已存在，请直接登陆！");
                returnValue = false;
                return false;
            }
            else if (pwdText < 6 || pwdText > 15) {
                alertMessage("密码由6-15位字符组成，请重新输入！");
                returnValue = false;
                return false;
            }
        }

        if (returnValue) {
            $("#regBtn").attr("disabled", "disabled");
        }
        if (returnValue) {
            var passwordEncode = encodePassword($("#password").val());
            $("#passwordEncode").val(passwordEncode);
        }
        return returnValue;
    }
    function checkIsVaildName() {
        if (!isVaildName($("#name").val())) {
            alertMessage("姓名中不能包含符号！");
        }
    }
    var validCode = true;
    function checkMobileUnique() {
        validCode = true;
        var mobile = $("#mobile").val();
        $.ajax({
            url: "/pwap/hrxfc/checkMobile",
            async: false,
            type: "get",
            data: {mobile: mobile},
            success: function (data) {
                if (data) {
                    /* $(".msgPrompt").show();
                     $(".msgPrompt").html("该用户已存在，请直接登陆！");*/
                    alertMessage("该用户已存在，请直接登陆！");
                    validCode = false;
                }
            }
        });
    }
    /**
     *获取验证码
     * @return {boolean}
     */
    function getCode() {
        if (!validCode) {
            return false;
        }
        var vphone = $("#mobile").val();
        if (!isMobel(vphone)) {
            alertMessage("手机号码格式不正确.");
            return false;
        }
        $.getJSON('/pwap/hrxfc/verifycode/' + vphone + '/', {}, function (json) {
            alertMessage(json.msg);
        });
        sendCode();
        return false;
    }

    function sendCode() {
        var count = 60;
        var countdown = setInterval(CountDown, 1000);

        function CountDown() {
            $("#smscode").hide();
            $("#smscodetime").show();
            $("#smscodetime").html(count);
            if (count == 0) {
                $("#smscodetime").hide();
                $("#smscode").show();
                clearInterval(countdown);
            }
            count--;
        }
    }

    function isMobel(value) {
        value = $.trim(value);
        if (value.match(/^1[3|4|5|6|7|8]\d{9}$/)) {
            return true;
        } else {
            return false;
        }
    }
    //用户名为字母、数字、中文
    function isVaildName(value) {
        if (value.match(/^[A-Za-z0-9\u4e00-\u9fa5]+$/)) {
            return true;
        } else {
            return false;
        }
    }

    $(function () {
        showBg();
        setTimeout("showBg()", 2000);
    });

    function showBg() {
        var width = document.body.offsetWidth;
        var height = document.body.offsetHeight;
        $('#JS_mask_layer').css({'width': width + 'px', 'height': height + 'px'});
        $('#JS_mask_layer').click(function () {
            $(this).addClass('none');
            $('.yanshi_lyer').addClass('none');
        })
    }

    function agreement(secondDomain) {
        window.location.href = "/pwap/" + secondDomain + "/agreement";
    }

    $(function () {
        $("input").focus(function () {
            $(this).next('img').show();
        });
        $("input").keyup(function () {
            $(this).next('img').show();
            return false;
        });
        $(".del-in").live('click', function () {
            $(this).prev('input').val("");
            $(this).hide();
        });
        $("input").blur(function () {
            $(this).next('img').hide();
            return false;
        });

    });

    $(function () {
        // 复选框点击
        $(".check-box, .check-box + span").live('click', function () {
            var _this = $(this).hasClass("check-box") ? $(this) : $(this).prev(".check-box");
            if (!_this.hasClass("disabled")) {
                _this.hasClass('selected') ? _this.removeClass('selected') : _this.addClass('selected');
            }
        });
    });

    // 设置input初始值为空
    function showDefVal() {
        $("#name").val("");
        $("#mobile").val("");
        $("#code").val("");
        $("#password").val("");
    }

</script>
</body>
</html>